<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			/* var arr3 = [6, 10, 12, 2, 19, 5];
			var t;
			for (var i = 0; i < arr3.length; i++) {
				for (var j = i + 1; j < arr3.length; j++) {
					if (arr3[i] > arr3[j]) {
						t = arr3[i];
						arr3[i] = arr3[j];
						arr3[j] = t;
					}
				}
			}
			console.log(arr3);

			var arr4 = [16, 100, 12, 22, 19, 15];
			var t1;
			for (var i = 0; i < arr4.length; i++) {
				for (var j = i + 1; j < arr4.length; j++) {
					if (arr4[i] > arr4[j]) {
						t1 = arr4[i];
						arr4[i] = arr4[j];
						arr4[j] = t1;
					}
				}
			}
			console.log(arr4); */

			function sort(arr) { //形参
				var temp;
				for (var i = 0; i < arr.length; i++) {
					for (var j = i + 1; j < arr.length; j++) {
						if (arr[i] > arr[j]) {
							temp = arr[i];
							arr[i] = arr[j];
							arr[j] = temp;
						}
					}
				}
			}

			var arr3 = [6, 10, 12, 2, 19, 5];
			sort(arr3);
			console.log(arr3);

			var arr4 = [16, 100, 12, 22, 19, 15];
			sort(arr4);
			console.log(arr4);


			function add(a) { //局部变量 6
				a1 = a + 1; //7
				console.log("-----------");
				// console.log(a + 1)
				console.log("-----------");
			}

			var a1 = 6; //全局变量
			add(a1);
			console.log(a1);
		</script>
	</head>
	<body>
	</body>
</html>
